<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  xmlns:a="http://xmlns.heustics.org/schema/myelin/0.1/" 
  xmlns:fhttp="http://xmlns.4suite.org/4ss/http"
  xmlns:email="http://xmlns.4suite.org/4ss/modules/e-mail"
  xmlns:xf="http://www.w3.org/2002/xforms"
  xmlns:o="http://xmlns.heustics.org/schema/myelin/0.1/AgentAccount#new"
  extension-element-prefixes="fhttp email"
  exclude-result-prefixes="a l fhttp email xf o xsl"
>       
  <xsl:variable name="o:l10n" select="a:get-l10n('&a;AgentAccount#new')"/>
  <xsl:variable name="o:params-l10n" select="$o:l10n/l:context[@name='params']/*"/>
  <xsl:variable name="o:hints-l10n" select="$o:l10n/l:context[@name='param-hints']/*"/>
  
  <xsl:template match="a:preferences|a:parents|a:base-uri|a:data-uri|a:type" mode="a:input-show"/>  
      
  <xsl:template match="a:submit[@key='commit']">    
    <xsl:param name="name"/>
    <xsl:param name="l10n"/>
    <xsl:param name='key' select='@key'/>
    <div class="input submit">
      <xsl:variable name='val' select='$l10n[@key="proceed"]'/>
      <input type='hidden' name='{$key}' value='{$val}'/>
      <input type='submit' name='{$name}' value='{$val}'/>
      <div class='spacer'/>
    </div>        
  </xsl:template> 
  
  <xsl:template match="a:submit[@key='close']">    
    <xsl:param name="name"/>
    <xsl:param name="l10n"/>
    <xsl:param name='key' select='@key'/>
    <div class="input submit">
      <xsl:variable name='val' select='$l10n[@key="cancel"]'/>
      <input type='hidden' name='{$key}' value='{$val}'/>
      <input type='submit' name='{$name}' value='{$val}'/>
      <div class='spacer'/>
    </div>        
  </xsl:template> 
  
  <xsl:template match="a:form[@mode='main' and @status='commit-success']"
    name="o:form-commit-success">
    <fhttp:response-uri
      uri='{a:format-url-ext(
        a:format-repeat-request(
          "edit",
          a:public-url(a:commit-node/@node-uri),
          @target,
          @target-action
        ),
        "msg","new-node"
      )}'/>
  </xsl:template> 
  
  <xsl:template match="a:profile" mode="a:input-show">
    <xsl:apply-templates mode="a:profile-input-show"/>
  </xsl:template>
  
  <xsl:template match="*" mode="a:profile-input-show"/>
  
  <xsl:template match="a:node-grouping" mode="a:profile-input-show">    
    <div class='input text profile-grouping'>  
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span><xsl:value-of select="$o:params-l10n[@key='profile-grouping']"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$o:hints-l10n[@key='profile-grouping']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>    
        <div class="entry">
          <xsl:variable name="opts" select="a:options"/>
          <xsl:choose>
            <xsl:when test="$opts/@count &gt; 1">
              <select name="profile-grouping">          
                <xsl:apply-templates select="$opts/*" mode="a:single-select-label">
                  <xsl:with-param name="selected" select="@selected"/>     
                </xsl:apply-templates>
              </select>    
            </xsl:when>
            <xsl:when test="$opts/@count = 1 and $opts/*[1]/@label">
              <span>
                <xsl:value-of select="$opts/*[1]/@label"/>
              </span>
            </xsl:when>
            <xsl:otherwise>
              <span>
                <xsl:value-of select="$o:l10n/l:gentext[@key='no-grouping']"/>
              </span>
            </xsl:otherwise>
          </xsl:choose>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>   
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
 
</xsl:stylesheet>

